package com.ktjiaoyu.service.impl;

import com.ktjiaoyu.entity.Supplier;
import com.ktjiaoyu.mapper.SupplierMapper;
import com.ktjiaoyu.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Service
public class SupplierServiceImpl implements SupplierService {

    @Autowired
    private SupplierMapper supplierMapper;

    @Override
    public List<Supplier> selectAllSuppliers() {
        return supplierMapper.selectAllSuppliers();
    }

    @Override
    public List<Supplier> selectSuppliersByName(String supName) {
        return supplierMapper.selectSuppliersByName(supName);
    }

    @Override
    @Transactional
    public int importSuppliers(List<Supplier> suppliers) {
        return supplierMapper.insertSuppliers(suppliers);
    }
}
